
<template>
  <div>
    <SearchForm
        @search="onSearch"
        @reset="onReset"
        :search-list="searchList" :search-params="searchParams">
    </SearchForm>

    <div class="table-layout">
      <el-card shadow="never">
        <div class="table-handle">
          <el-button type="primary" size="mini" icon="el-icon-plus" @click="onAdd">新增</el-button>
        </div>
        <div class="table-box">
          <el-table
              size="large"
              stripe
              border
              v-loading="loading"
              max-height="500px"
              :data="tableData"
              row-key="id"
              element-loading-spinner="el-icon-loading"
              element-loading-background="rgba(255, 255, 255, 0.8)"
              @selection-change="onSelect"
          >
            <!--            订单的头表信息-->
            <el-table-column type="selection" width="55"/>
            <el-table-column prop="name" label="名称"/>
            <el-table-column prop="type" label="类型">
              <template slot-scope="scope">
                <el-tag v-if="scope.row.type == 0" type="info">注册协议</el-tag>
                <el-tag v-if="scope.row.type == 1" type="info">充值协议</el-tag>
                <el-tag v-if="scope.row.type == 2" type="info">使用帮助</el-tag>
              </template>
            </el-table-column>
            <el-table-column label="操作" fixed="right" width="150px">
              <template slot-scope="scope">
                <el-button type="text" @click="onEdit(scope.row)">编辑</el-button>
                <el-button type="text" style="color: #F82222" @click="onDelete(scope.row)">删除</el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
      </el-card>

      <div class="page-box">
        <el-pagination
            background
            :current-page="pageNo"
            :page-sizes="pageSizes"
            :page-size="pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="totalSize"
            @size-change="changePageSize"
            @current-change="changePageNo"
        />
      </div>
    </div>
    <Add ref="addFormRef" @get-page="initData" />
  </div>
</template>
<script>

import crud from "@/mixins/crud";
import { http } from "@/api";
import Add from "./add.vue";
export default {
  name: "index",
  components: {
    Add
  },
  mixins: [crud],
  data() {
    return {
      request:http.policy,
      searchList: [
        {
          label: '名称',
          prop: 'name',
          name: 'input',
          clearable: true
        },
        {
          label: '类型',
          // 登录协议、充值协议
          prop: 'type',
          name: 'select',
          options: [
            {
              value: '',
              label: '全部'
            },
            {
              value: 0,
              label: '登录协议'
            },
            {
              value: 1,
              label: '充值协议'
            },
            {
              value: 2,
              label: '使用帮助'
            },
          ]
        }
      ],
      searchParams: {
        name: '',
        type: ''
      },
      tableData: [

      ]
    }
  },
  methods: {
  }
}
</script>

<style scoped lang="scss">

</style>
